﻿using System.Data;
using Microsoft.ApplicationBlocks.Data;

namespace DataObject.OrderDetail
{
    public class OrderDetailDAL
    {
        public static void OrderDetail_Create(OrderDetailObject o)
        {
            SqlHelper.ExecuteScalar(Constants.ConnectionString, "OrderDetail_Create", 
                                        o.OrderId, o.ParentId, o.CategoryId, o.ProductId, o.Quantity, o.UnitPrice, o.Discount);
        }

        public static void OrderDetail_Delete(int orderDetailId)
        {
            SqlHelper.ExecuteScalar(Constants.ConnectionString, "OrderDetail_Delete", orderDetailId);
        }

        public static void OrderDetail_DeleteAll_ByOrderId(int orderId)
        {
            SqlHelper.ExecuteScalar(Constants.ConnectionString, "OrderDetail_DeleteAll_ByOrderId", orderId);
        }

        public static IDataReader OrderDetail_GetListByOrderId(int orderId)
        {
            return SqlHelper.ExecuteReader(Constants.ConnectionString, "OrderDetail_GetListByOrderId", orderId);
        }

    }
}
